
#include "ps_es_adaptation.h"

#define IN_FILENAME		"c.h264"
#define READ_SIZE		(1024)

int main(void)
{
	int ret = 0;
    FILE *in_file = NULL;
	
    char *frame_buffer = NULL;
    frame_buffer = (char *)malloc(READ_SIZE);
	
	in_file = fopen(IN_FILENAME,"r");
    if(in_file == NULL)
    {
        printf("open in file error!\n");
    }
    
	while(1)
	{
		memset(frame_buffer,0,READ_SIZE);
		ret = fread(frame_buffer,READ_SIZE,1,in_file);
		if(ret != 1)
		{
			printf("ret = %d\n");
			printf("fread file error!\n");
		}
        ret = ps_es_adaptation_process(frame_buffer,READ_SIZE);
        if(ret == -1)
        {
            printf("input error\n");
        }
        else if(ret == 0)
        {
            printf("H264 stream....\n");
        }
        else if(ret == 1)
        {
            printf("PS stream....\n");
        }
        else
        {
            printf("error\n");
        }
        break;

	}
    
	free(frame_buffer);
	fclose(in_file);
    printf("Done!\n");
}





  





